package com.example.demo.mapper;

import com.example.demo.pojo.Role;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author sssl
 * @since 2022-03-10
 */
@Mapper
public interface RoleMapper extends BaseMapper<Role> {

    @Select("select id,name from t_role where id in(select role_id from t_user_role where user_id = #{userId})")
    List<Role> getRolesByUserId(@Param("userId") Long userId);
}
